package com.gugee.ins.data.task.analysis;

import com.gugee.common.task.dto.TaskParam;
import com.gugee.ins.data.task.analysis.service.*;
import com.gugee.ins.data.task.constant.TaskType;
import com.xiguaji.boot.toolkit.JsonUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 大博主分析任务
 * @author Huangxin
 */
@Component
@Slf4j
public class InsAnalysisTask {

    /**
     *
     */
    @Autowired
    public InsAnalysisAvatarSvc insAnalysisAvatarSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisLanguageSvc insAnalysisLanguageSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisLocationSvc insAnalysisLocationSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisIncomeSvc insAnalysisIncomeSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisCategorySvc insAnalysisCategorySvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisAccountCheckUnusualSvc insAnalysisAccountCheckUnusualSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisBrandSvc insAnalysisBrandSvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisBrandCategorySvc insAnalysisBrandCategorySvc;

    /**
     *
     */
    @Autowired
    public InsAnalysisProductCategorySvc insAnalysisProductCategorySvc;

    /**
     * 分析头像信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一页最多的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisAvatar")
    public ReturnT<String> sendMBloggerMsg4AnalysisAvatar(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisAvatarSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_AVATAR.getValue(),"sendMBloggerMsg4AnalysisAvatar",taskParam,false);
    }

    /**
     * 分析语言信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisLanguage")
    public ReturnT<String> sendMBloggerMsg4AnalysisLanguage(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisLanguageSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_LANGUAGE.getValue(),"sendMBloggerMsg4AnalysisLanguage",taskParam,false);
    }

    /**
     * 分析国家信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisLocation")
    public ReturnT<String> sendMBloggerMsg4AnalysisLocation(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisLocationSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_LOCATION.getValue(),"sendMBloggerMsg4AnalysisLocation",taskParam,false);
    }

    /**
     * 分析收入信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisIncome")
    public ReturnT<String> sendMBloggerMsg4AnalysisIncome(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisIncomeSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_INCOME.getValue(),"sendMBloggerMsg4AnalysisIncome",taskParam,false);
    }

    /**
     * 分析分类信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisCategory")
    public ReturnT<String> sendMBloggerMsg4AnalysisCategory(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisCategorySvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_CATEGORY.getValue(),"sendMBloggerMsg4AnalysisCategory",taskParam,false);
    }

    /**
     * 分析账户是否异常信息发送
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendMBloggerMsg4AnalysisAccountCheckUnusual")
    public ReturnT<String> sendMBloggerMsg4AnalysisAccountCheckUnusual(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisAccountCheckUnusualSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_ACCOUNT_UNUSUAL.getValue(),"sendMBloggerMsg4AnalysisAccountCheckUnusual",taskParam,false);
    }

    /**
     * 分析品牌
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendBloggerMsg4AnalysisBrand")
    public ReturnT<String> sendBloggerMsg4AnalysisBrand(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisBrandSvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_BRAND.getValue(),"sendBloggerMsg4AnalysisBrand",taskParam,false);
    }

    /**
     * 分析品牌分类
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendBloggerMsg4AnalysisBrandCategory")
    public ReturnT<String> sendBloggerMsg4AnalysisBrandCategory(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisBrandCategorySvc.xxlJobStart(TaskType.BLOGGER_ANALYSIS_BRAND_CATEGORY.getValue(),"sendBloggerMsg4AnalysisBrandCategory",taskParam,false);
    }

    /**
     * 分析商品分类
     * @param param  {"records":2000,"pagesLimit":10000}
     *                  records:一次最多的收录的记录数
     *                   pagesLimit：发送最大页数
     * @return 调度结果
     */
    @XxlJob("sendBloggerMsg4AnalysisProductCategory")
    public ReturnT<String> sendBloggerMsg4AnalysisProductCategory(String param) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, param);
        return insAnalysisProductCategorySvc.xxlJobStart(TaskType.PRODUCT_ANALYSIS_CATEGORY.getValue(),"sendBloggerMsg4AnalysisProductCategory",taskParam,false);
    }
}
